//
//  Marco.h
//  ERVICE
//
//  Created by apple on 16/3/16.
//  Copyright © 2016年 hbjApple. All rights reserved.
//

#ifndef Marco_h
#define Marco_h
#define ApplicationDelegate                 ((AppDelegate *)[[UIApplication sharedApplication] delegate])
#define UserDefaults                        [NSUserDefaults standardUserDefaults]
#define NavBarHeight                        self.navigationController.navigationBar.bounds.size.height
#define TabBarHeight                        self.tabBarController.tabBar.bounds.size.height
#define ScreenWidth                         [[UIScreen mainScreen] bounds].size.width
#define ScreenHeight                        [[UIScreen mainScreen] bounds].size.height
#define ViewWidth(v)                        v.frame.size.width
#define ViewHeight(v)                       v.frame.size.height
#define ViewX(v)                            v.frame.origin.x
#define ViewY(v)                            v.frame.origin.y
#define SelfViewWidth                       self.view.bounds.size.width
#define SelfViewHeight                      self.view.bounds.size.height
#define RectX(f)                            f.origin.x
#define RectY(f)                            f.origin.y
#define RectWidth(f)                        f.size.width
#define RectHeight(f)                       f.size.height


#define KLebronAccount @"18356002898"
#define KPhoneNumIsRight(phoneNum) (phoneNum.length == 11) ? YES : NO


#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.width - ( double )568 ) < DBL_EPSILON )
#define IS_IPHONE_6P (ScreenWidth > 375) ? YES : NO
#define IS_IPHONE_X (ScreenHeight == 812.0) ? YES : NO
#define IS_IOS7             ([[[UIDevice currentDevice] systemVersion] compare:@"7.0" options:NSNumericSearch] != NSOrderedAscending)

//#define RGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]

#define KNOTIFICATION_LOGINCHANGE @"loginStateChange"

#define CHATVIEWBACKGROUNDCOLOR [UIColor colorWithRed:0.936 green:0.932 blue:0.907 alpha:1]


#define ISLITEVERSION [[[Config Instance] getVersionInfo] isEqualToString:@"v1"]

///  APP KEY
#define APP_KEY_WEIXIN            @"wxd930ea5d5a258f4f"

#define APP_KEY_QQ                @"222222"

#define APP_KEY_WEIBO             @"2045436852"

#define APP_KEY_WEIBO_RedirectURL @"http://www.sina.com"

///  分享图片
#define SHARE_IMG [UIImage imageNamed:@"logo.jpg"]

#define SHARE_IMG_COMPRESSION_QUALITY 0.5

///  Common size
#define SIZE_OF_SCREEN    [[UIScreen mainScreen] bounds].size
//获取tabbar高度
#define TABBARHEIGHT 46
//顶部高度
#define SafeAreaTopHeight (ScreenHeight == 812.0 ? 88 : 64)
//底部buttom高度
#define SafeAreaBottomHeight (ScreenHeight == 812.0 ? 34 : 0)

/// View 圆角
#define ViewRadius(View, Radius)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES]

///  View加边框
#define ViewBorder(View, BorderColor, BorderWidth )\
\
View.layer.borderColor = BorderColor.CGColor;\
View.layer.borderWidth = BorderWidth;

#define showAlert(_msg){UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:_msg delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定",nil];[alert show];}

#define kQQ         @"qq"// qq授权登录
#define kWeixin         @"Weixin"// Weixin授权登录
#define kSina         @"Sina"// Sina授权登录
#define ShowSVProgressErrorMessage(errorMsg) [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeGradient];  [SVProgressHUD setMaximumDismissTimeInterval:2];[SVProgressHUD showInfoWithStatus:errorMsg];
/**
 iphone x
 iOS 11上面废除了automaticallyAdjustsScrollViewInsets

 @param controller 控制器
 @param scrollview scrollview
 @return 结果
 */
#define AdjustsScrollViewInsetNever(controller,scrollview) if (@available(iOS 11.0,*)) {scrollview.contentInsetAdjustmentBehavior = UIApplicationBackgroundFetchIntervalNever;}else{controller.automaticallyAdjustsScrollViewInsets = false;}
/// 高度系数 812.0 是iPhoneX的高度尺寸，667.0表示是iPhone 8 的高度，如果你觉的它会变化，那我也很无奈
#define HBJHeightCoefficient (ScreenHeight == 812.0 ? ScreenHeight/667.0 : 667.0/667.0 )

#define MYXLuckyMoneyPictureViewOutterMargin 20.0
#define MYXLuckyMoneyPictureViewInnterMargin 3.0
#define MYXPictureViewWith  ScreenWidth  - 2*MYXLuckyMoneyPictureViewOutterMargin
#define MYXLuckyMoneyPictureItemWith   (MYXPictureViewWith - 2*MYXLuckyMoneyPictureViewInnterMargin) / 3
#endif /* Marco_h */
